/// <reference path="./BaseOral.ts" />
namespace wmedu {
    /** 四则运算：单减法 */
    export class FourOper_Sub extends BaseOral implements IOralCreater {
        create(opt: IOralOpt) {
            let paramArea = opt.paramArea;
            let ops: Enum_OralOp[] = [Enum_OralOp.Sub];
            // 先得到被减数
            let p1 = this.mGetRandomInt(paramArea);
            // 再随机减数
            let p2 = MathUtil.randomInt(p1 - 1, 1);//得数不能为0，因为有可能除法除此结果要出错
            let value = p1 - p2;

            let str = BuildUtil.getOralStr(opt.blankSide, opt.blankStr, [p1, p2], ops, value);
            let res: IOralSide = { nums: [p1, p2], ops: ops, value: value, str }
            return res;
        }
    }
}